////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 
// 
// This file is part of the Microsoft .NET Micro Framework Porting Kit Code Samples and is unsupported. 
// Copyright (C) Microsoft Corporation. All rights reserved. Use of this sample source code is subject to 
// the terms of the Microsoft license agreement under which you licensed this sample source code. 
// 
// THIS SAMPLE CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 
// INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// 
// 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <cores\arm\include\cpu.h>

//--//


void HAL_AssertEx()
{
    // cause an abort and let the abort handler take over
    *((char*)0xFFFFFFFF) = 'a';
}


BOOL CPU_Initialize()
{
    return AT91_SAM_Driver::Initialize();
}

void CPU_Uninitialize()
{
    AT91_SAM_Driver::Uninitialize();
}

void CPU_Pause()
{
    AT91_SAM_Driver::Pause();
}

void CPU_DisplayProcessorInformation()
{
    AT91_SAM_Driver::DisplayProcessorInformation();
}

//--//

#pragma arm section code

void CPU_ChangePowerLevel(POWER_LEVEL level)
{
    switch(level)
    {
        case POWER_LEVEL__MID_POWER:
            break;

        case POWER_LEVEL__LOW_POWER:
            break;

        case POWER_LEVEL__HIGH_POWER:
        default:
            break;
    }
}

void CPU_Sleep(SLEEP_LEVEL level, UINT64 wakeEvents)
{
    switch(level)
    {
        case SLEEP_LEVEL__DEEP_SLEEP:
            AT91_SAM_Driver::Hibernate();
            break;
        case SLEEP_LEVEL__OFF:
            AT91_SAM_Driver::Shutdown();
            break;
        case SLEEP_LEVEL__SLEEP:
        default:
            AT91_SAM_Driver::Sleep();
            break;
    }
}


void CPU_Halt()
{
    AT91_SAM_Driver::Halt();
}

void CPU_Reset()
{
    AT91_SAM_Driver::Reset();
}

BOOL CPU_IsSoftRebootSupported ()
{
    return TRUE;
}

